package rooms.southPod;

import actions.Direction;
import exceptions.MudExceptions;
import mobs.DaveWilliams;
import rooms.Room;
import mobs.NPC;
import items.Item;
import items.armor.FishbowlFuryTShirt;

import java.util.ArrayList;
import java.util.List;

public class OremLobby implements Room {
    private static Room me;

    private List<NPC> mobs = new ArrayList<NPC>();
    private List<Item> items = new ArrayList<Item>();

    public OremLobby() {
        items.add(new FishbowlFuryTShirt());
        mobs.add(new DaveWilliams());
    }

    public static synchronized Room getInstance() {
        if (me == null) {
            me = new OremLobby();
        }
        return me;
    }

    public String getTitle() {
        return "Orem Lobby";
    }

    public String getDescription() {
        return "You are standing in the lobby of Fishbowl's Orem office.  You see couches, chairs, a ping pong table" +
                ", a foosball table, and extremely ugly orange circles of carpet.";
    }

    public String getLongDescription() {
        return "This is the room where Fishbowl employees waste moste of their time.  Many intense games of ping " +
                "pong and foosball have been played here.  The orange carpet circles are stained and the furniture is mismatched.  " +
                "The room has a feeling of greatness, the voices of champions past are whispering something that you can't " +
                "quite understand.";
    }

    public Room getRoomMove(Direction direction) {
        Room room;
        if (direction == Direction.SOUTH) {
            room = ReceptionistsLobby.getInstance();
        } else if (direction == Direction.DOWN) {
            throw MudExceptions.invalidMoveDown();
        } else if (direction == Direction.UP) {
            throw MudExceptions.invalidMoveUp();
        } else {
            throw MudExceptions.invalidMove();
        }
        return room;
    }

    public List<NPC> getActiveNPCs() {
        return mobs;
    }

    public String showMobs() {
        StringBuffer rtn = new StringBuffer();
        for (NPC npc : getActiveNPCs()) {
            rtn.append(npc.getName());
            rtn.append("\n");
        }
        return rtn.toString();
    }

    public List<Item> getRoomItems() {
        return items;
    }

    public String showItems() {
        StringBuffer rtn = new StringBuffer();
        for (Item item : getRoomItems()) {
            rtn.append(item.getTitle());
            rtn.append("\n");
        }
        return rtn.toString();
    }
}